package cc.customer.web.sys.controller.system;

import cc.customer.common.annotation.Log;
import cc.customer.common.domain.ResponseBo;
import cc.customer.system.domain.ExConfig;
import cc.customer.system.domain.ExConfigRecord;
import cc.customer.system.service.ExModalServices;
import cc.customer.web.sys.controller.base.BaseController;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class ExModalConfigController extends BaseController {

    @Autowired
    private ExModalServices exModalServices;

    /**新增推广模板**/
    @RequestMapping(value = "exModal/exModalAdd")
    @ResponseBody
    public ResponseBo exModalAdd(ExConfig exConfig){
        return exModalServices.exModalAdd(exConfig);
    }
    /**删除推广得模板**/
    @RequestMapping(value = "exModal/exModalDel")
    @ResponseBody
    public ResponseBo exModalDel(ExConfig exConfig){
        return exModalServices.exModalDel(exConfig);
    }
    /**初始化推广模板**/
    @RequestMapping(value = "exModal/exModalAll")
    @ResponseBody
    public ResponseBo exModalAll(ExConfig config){
        if(StringUtils.isEmpty(config.getExCfgType())){
            return ResponseBo.error("type为空");
        }
        return exModalServices.selcetAllExModal(config);
    }
    /**查询制定模板得详细信息**/
    @RequestMapping(value = "exModal/exModalRecordAll")
    @ResponseBody
    public ResponseBo exModalRecordAll(ExConfigRecord exConfigRecord){
        return exModalServices.selectAllExModalRecords(exConfigRecord);
    }

    /**保存修改模板**/
    @RequestMapping(value = "exModal/exModalRecordedit")
    @ResponseBody
    @Log("修改了推广资源模板内容")
    public ResponseBo exModalRecordedit(ExConfigRecord exConfigRecord){
        return exModalServices.editExModalRecords(exConfigRecord);
    }


}
